<template>
  <div>
    <el-table
      :data="eventList"
      stripe
      border
      style="width: 100%; margin-top: 10px"
      height="400"
    >
      <el-table-column prop="CAR_STATUS" label="出车状态" width="180" fixed>
      </el-table-column>
      <el-table-column prop="INCOMING_CALL_NUMBER" label="来电号码" width="180">
        <template slot-scope="data">
          <div v-contextmenu:menuEvent :data-index="data.$index">
            {{ data.row.INCOMING_CALL_NUMBER }}
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="CALL_TIME" label="呼叫时间" width="180">
      </el-table-column>
      <el-table-column prop="TOWN" label="市镇" width="180"> </el-table-column>
      <el-table-column prop="DISTRICT_STREET" label="区街" width="180">
      </el-table-column>
      <el-table-column prop="DETAIL_ADDRESS" label="详细地点" width="180">
      </el-table-column>
      <el-table-column prop="POSITIONING_LOCATION" label="定位地点" width="180">
      </el-table-column>
      <el-table-column prop="PATIENT_NAME" label="患者姓名" width="180">
      </el-table-column>
    </el-table>
    <v-contextmenu ref="menuEvent" @contextmenu="contextmenu">
      <v-contextmenu-item :disabled="true">回拨</v-contextmenu-item>
      <v-contextmenu-item :disabled="true">车载通话</v-contextmenu-item>
      <v-contextmenu-item @click="menuSave('IS_SUBSTATION')"
        >分站派车单</v-contextmenu-item
      >
      <v-contextmenu-item @click="menuSave('IS_VEHICLE')"
        >车载派车单</v-contextmenu-item
      >
      <v-contextmenu-item
        @click="menuSave('IS_REINFORCE')"
        style="color: #0000ff; font-weight: bold"
        >添加增援单</v-contextmenu-item
      >
      <v-contextmenu-item
        @click="menuSave('IS_CASE_SHEET')"
        style="color: #0000ff; font-weight: bold"
        >添加病例单</v-contextmenu-item
      >
      <v-contextmenu-item
        @click="menuSave('IS_REASSIGNMENT')"
        style="color: #0000ff; font-weight: bold"
        >改派分站派车单</v-contextmenu-item
      >
      <v-contextmenu-item
        @click="menuSave('IS_CASE')"
        style="color: #0000ff; font-weight: bold"
        >添加电子病历</v-contextmenu-item
      >
      <v-contextmenu-item
        @click="menuSave('IS_MAJOR_ACCIDENTS')"
        style="color: #ff0000; font-weight: bold"
        >重大事故</v-contextmenu-item
      >
    </v-contextmenu>
  </div>
</template>
<script>
import { saveOrUpdateEvent } from "@/api/emergencyDispatch/emergencyDispatch.js";
export default {
  components: {},
  props: ["eventList"],
  data() {
    return {
      eventMenuIndex: 0,
    };
  },
  computed: {},
  mounted() {},
  methods: {
    menuSave(key) {
      let data = {
        [key]: "1",
        ACCEPTANCE_NO: this.eventList[this.eventMenuIndex].ACCEPTANCE_NO,
      };
      saveOrUpdateEvent(data).then((res) => {
        this.$message({
          duration: 1000,
          message: res.message,
          type: "success",
        });
      });
    },
    contextmenu(node) {
      this.eventMenuIndex = node.elm.getAttribute("data-index");
    },
  },
};
</script>
<style scoped lang='scss'>
</style>
